package com.suwenhao.service;


import com.suwenhao.dao.UserDao;
import com.suwenhao.entity.Dept;
import com.suwenhao.entity.Page;
import com.suwenhao.entity.User;

import java.util.List;

/**
 * @Author:suwenhao
 * @Description: 测试
 * @Date: Created in 2020/9/22 17:35
 */
public class UserService {
    private UserDao userDao=new UserDao();
    public User checkLogin(String username,String password){
        return userDao.checkLogin(username,password);
    }

    //查询
    public List<User> userList(String username, Page page) {
        return userDao.userList(username,page);
    }

    //计算页
    public Integer count(String name){
        return userDao.count(name);
    }

    //添加
    public void add(User user) {
        userDao.add(user);
    }


    //回写部门
    public List<Dept> listDept() {
        return userDao.listDept();
    }

    //删除
    public void delete(Integer id) {
            userDao.delete(id);
    }

//    回写数据
    public User getUserById(Integer id){
       return userDao.getUserById(id);
    }
    //修改数据回写数据
    public void update(User user){
         userDao.update(user);
    }


    //修改数据库pic
    public void updatePic(Integer id,String pic){
        userDao.updatePic(id,pic);
    }

    //通过部门id查询该部门下的所有员工
    public List<User> getUserByDeptId(Integer id) {
        return userDao.getUserByDeptId(id);
    }

    public void updatePassword(User user){
        userDao.updatePassword(user);
    }
}
